package blf.librarysystem.Dao;

import blf.librarysystem.Pojo.Book;
import blf.librarysystem.Pojo.BookExample;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestParam;

public interface BookMapper {
    long countByExample(BookExample example);

    int deleteByExample(BookExample example);

    int deleteByPrimaryKey(Integer bookId);

    int insert(Book record);

    int insertSelective(Book record);

    List<Book> selectByExample(BookExample example);

    Book selectByPrimaryKey(Integer bookId);

    int updateByExampleSelective(@Param("record") Book record, @Param("example") BookExample example);

    int updateByExample(@Param("record") Book record, @Param("example") BookExample example);

    int updateByPrimaryKeySelective(Book record);

    int updateByPrimaryKey(Book record);


    //自定义的数据库操作
    int getTotalCount();

    List<Book> listAll(int start, int limit);

    int borrowBook(@Param("borrowId") Integer borrowId, @Param("bookId") Integer bookId);

    int returnBook(@Param("bookId") Integer bookId);

    int getCountByKeys(@RequestParam("bookName") String bookName, @RequestParam("borrowStatus") String borrowStatus);

    List<Book> listByKeys(@RequestParam("bookName") String bookName, @RequestParam("borrowStatus") String borrowStatus, int start, int limit);

}